$(function() {

	var current = {
		initView: function() {
			//轮播图
			global.getDataRequest('POST', 'jsonp', global.ctx + global.bannerUrl, {
				'type': 'beauty'
			}, function(json) {
				var bannerArr = json.data;
				$('#swiper_wrapper_js').empty();
				for(var i = 0; i < bannerArr.length; i++) {
					$('#swiper_wrapper_js').append('<a class="swiper-slide"><img src="' + bannerArr[i].pictureUrl + '"/></a>');
				}

				if(bannerArr.length == 1) {
					var mySwiper = new Swiper('.swiper-container', {
						autoplay: 3000,
						direction: 'horizontal',
						pagination: '.swiper-pagination',
					});
				} else {
					var mySwiper = new Swiper('.swiper-container', {
						autoplay: 3000,
						direction: 'horizontal',
						loop: true,
						pagination: '.swiper-pagination',
					});
				}
			});
			//列表
			global.getDataRequest('POST', 'jsonp', global.ctx + global.facecloListUrl, {}, function(json) {
				console.log(json);
				$('#beauty_list_js').empty();
				var listArr = json.data;
				for(var i = 0; i < listArr.length; i++) {
					var str = '<li>';
					str += '<a href="storeDetail.html?type=beauty&id=' + listArr[i].id + '">';
					str += '<div class="beauty-list-left">';
					str += '<img src="' + listArr[i].headImageUrl + '?imageView2/1/w/200/h/200' + '" alt="图片" />';
					str += '</div>';
					str += '<div class="beauty-list-right">';
					str += '<h4>' + listArr[i].name + '</h4>';
					str += '<p>' + listArr[i].address + '</p>';
					str += '</div>';
					str += '</a>';
					str += '</li>';
					$('#beauty_list_js').append(str);
				}
			});
		},
	};

	current.initView();
});